<script>
     def get_token_params(self):
        """
     //   构建JS传递的参数的方法
        :return:
        """
        token_param = {
    
            "rid": f"R_SO_4_{self.song_id}",
            "threadId": f"R_SO_4_{self.song_id}",
            "pageNo": str(self.page),
            "pageSize": "20",
            "cursor": f"{str(self.timestamp)}",
            "offset": "40",
            "orderType": "1",
            "csrf_token": ""}
        return json.dumps(token_param)

    def get_post_data(self):
        """
        逆向JS并获取post请求的data数据的方法
        :return:
        """
        token_param = self.get_token_params()
        with open('./wyy_comment.js', 'r', encoding='utf-8') as jsfile:
            js_code = execjs.compile(jsfile.read())
            result = js_code.call('get_token', f'{token_param}')
        return {
    
            "params": result.get('encText'),
            "encSecKey": result.get('encSecKey'),
        }
</script>